package com.itheima.stock.mapper;

import com.itheima.stock.common.domain.InnerMarketDomain;
import com.itheima.stock.pojo.StockMarketIndexInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Entity com.itheima.stock.pojo.StockMarketIndexInfo
 */
@Mapper
public interface StockMarketIndexInfoMapper {

    int deleteByPrimaryKey(Long id);

    int insert(StockMarketIndexInfo record);

    int insertSelective(StockMarketIndexInfo record);

    StockMarketIndexInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StockMarketIndexInfo record);

    int updateByPrimaryKey(StockMarketIndexInfo record);

    /**
     * 根据指定时间点和大盘编码查询大盘信息
     * @param curTime 时间点，精确到分钟
     * @param marketCoes 大盘id集合
     * @return
     */
    List<InnerMarketDomain> findMarketInfoByTimeAndCodes(@Param("curTime") Date curTime,
                                                         @Param("marketCoes") List<String> marketCoes);

    /**
     *查询指定大盘下在指定日期范围内的成交量信息
     * @param marketCodes 大盘id集合
     * @param startTime 开始时间
     * @param endTime 截止时间（不一定是收盘时间）
     * @return
     */
    List<Map> getTradeVolInfoByTime(@Param("marketCodes") List<String> marketCodes,
                                    @Param("startTime") Date startTime,
                                    @Param("endTime") Date endTime);

    /**
     * 批量插入数据
     * @param infos
     * @return
     */
    int insertBatch(@Param("infos") List<StockMarketIndexInfo> infos);
}
